<template>
	<view class="product-recommendation-list-component-containter">
		<view class='produce-item-component-containter'>
			<view class="item" @tap="() => toDetail(item)">
				<image mode="scaleToFill" class="img" :src="item.productSquareUrl" />
				<view class="desc">
					<view :style="{ 'max-width': maxWidth + 'rpx' }" class="name">{{ item.productName }}</view>
					<view class="tips">{{ item.productDesc }}
					</view>
					<view class="bottom">
						<view>
							<view class="money">
								<span class="current_price_title">现价</span>
								<span>¥{{ item.currentPrice }}</span>
							</view>
							<view class="member_money">
								<view class="month_money">原价￥{{ item.originalPrice }}</view>
							</view>
						</view>
						<image class="cart" src="../../../static/img/components/cart_theme.png" @tap="onAddCart" />
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		props: {
			item: {
				type: Object,
				default: {
					productIconUrl: []
				},
			},
			maxWidth: {
				type: Number,
				default: 400
			},
		},
		mounted() {},
		onLoad() {},
		methods: {
			toDetail(item) {
				uni.navigateTo({
					url: '/pages/goodsDetail/index?productId=' + item.productId,
				})
			},
			onAddCart(e) {
				e.preventDefault();
				e.stopPropagation();
			}
		}
	}
</script>

<style scoped>
	.produce-item-component-containter {
		position: relative;
		width: 100%;
		height: 315rpx;
		/* background: white; */
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
	}

	.produce-item-component-containter .item {
		display: flex;
		flex-wrap: nowrap;
		justify-content: center;
		align-items: center;
		column-gap: 20rpx;
		width: 100%;
		padding: 0 3%;
		box-sizing: border-box;
	}

	.produce-item-component-containter .item .img {
		width: 254rpx;
		height: 230rpx;
		border-radius: 15rpx;
	}

	.produce-item-component-containter .item .desc {
		height: 254rpx;
		margin: 30rpx 0rpx 35rpx 0rpx;
		text-align: left;
		flex: 1;
	}

	.produce-item-component-containter .item .desc .name {
		max-width: 400rpx;
		font-size: 32rpx;
		color: rgba(51, 51, 51, 1);
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		line-height: 52rpx;
		text-align: left;
	}

	.produce-item-component-containter .item .desc .tips {
		font-size: 22rpx;
		color: rgba(153, 153, 153, 1);
		line-height: 30rpx;
		height: 90rpx;
		word-break: break-all;
		overflow-y: scroll;
		margin-top: 20rpx;
	}

	.produce-item-component-containter .item .desc .bottom {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.money {
		font-size: 40rpx;
		font-weight: bold;
		color: #f25500;
		margin-bottom: 10rpx;
	}

	.member_money {
		font-size: 18rpx;
		font-weight: 500;
		color: rgba(153, 153, 153, 1);
		display: flex;
		flex-direction: row;
		text-decoration: line-through;
	}

	.month_money {
		margin-right: 24rpx;
		font-size: 24rpx;
	}

	.produce-item-component-containter .cart {
		width: 51rpx;
		height: 51rpx;
	}

	.produce-item-component-containter .line {
		width: 92%;
		height: 1rpx;
		background: rgba(229, 229, 229, 1);
		z-index: 1;
	}

	.current_price_title {
		font-size: 20rpx;
	}
</style>